<#include "../common/layout.ftl"/>
<@layout>
<div class="well">

	<form method="post" action="/vipmember" class="form-inline">
		<#if session.userRole == 'admin' || session.userRole == 'brandManager'>
			<span class="label label-success">VIP客户会员申请列表</span>
			姓名:<input type="text" class="input-medium" style="height: 26" placeholder="姓名" name="real_name"/>
			手机号：<input type="text" class="input-medium" style="height: 26" placeholder="手机号" name="cell_phone"/>
			<button type="submit" class="btn btn-primary"><i class="icon-search icon-white"></i>查询</button>
		</#if>
	</form>
  </div>

<div class="well">

	<table class="table table-bordered table-striped">
		<thead>
		  <tr>
			<th>ID</th>
			<th>姓名</th>
			<th>手机号码</th>
			<th>性别</th>
			<th>车牌号码</th>
			<th>订单量</th>
			<th>订单额</th>
			<th>账户余额</th>
			<th>身份证</th>
			<th>邮件</th>
			<th>常用地址</th>
			<th>注册时间</th>
			<th>状态</th>
			<th>备注</th>
			<th>操作</th>
		  </tr>
		</thead>
		<tbody>
		<#list page.list as member>
		  <tr>
			<td>
			  <span class="label">${member.id}</span>
			</td>
			<td>
			  ${member.real_name}
			</td>
			<td>
			  ${member.cell_phone}
			</td>
			<td>
			  <#if member.sex == 0>
			  	<span class="label label-info">男</span>
			  <#elseif member.sex == 1>
			  	<span class="label label-warning">女</span>
			  <#else>
			  	<span class="label label-inverse">未知</span>
			  </#if>
			</td>
			<td>
			  ${member.plage_number!""}
			</td>
			<td>
			  ${member.order_count!""}
			</td>
			<td>
			  ${member.sum_money!"0"}
			</td>
			<td>
				<#if member.balance??>
					￥${member.balance?string(",##0.00#")}
				<#else>
					0.0
				</#if>
			</td>
			<td>
			  ${member.card_id!""}
			</td>
			<td>
			  ${member.email_no!""}
			</td>
			<td>
			  ${member.endpoint!""}
			</td>
			<td>
			   <#if member.create_time??> 
			    ${member.create_time?string("yyyy年MM月dd日HH时mm分ss秒") }  
			   </#if>  
			</td>
			<td>
			  <#if member.status == 1>
			  	<span class="label label-success">正常</span>
			  <#elseif member.status == 2>
			  	<span class="label label-inverse">黑名单</span>
			  <#else>
			  	<span class="label label-info">已删除</span>
			  </#if>
			</td>
			<td>
			  ${member.remark!""}
			</td>
			<td>
				<div class="btn-group">
					 <#if session.userRole == 'admin' || session.userRole == 'brandManager' || session.userRole == 'middleManager' || session.userRole == 'customerCenter'>
					 	<a class="btn btn-primary" href="javascript:submitApply(${member.id})"><i class="icon-leaf icon-white"></i> 审核通过</a>
						<a class="btn btn-primary" href="/vipmember/edit/${member.id}"><i class="icon-info-sign icon-white"></i> 修 改</a>
					 </#if>
				</div>
			</td>
		  </tr>
		</#list>
		</tbody>
	</table>  
	<#include "../common/paginate.ftl" />
	<@paginate currentPage=page.pageNumber totalPage=page.totalPage actionUrl="/vipmember/" />
</div>

<script type="text/javascript">
	function submitApply(memberId){
		var visitUrl = "/vipmember/applyAccept/"+memberId+"?time="+new Date();
		$.ajax({
	        url: visitUrl,
	        data: '',
	        type:"GET",
	        async :true, // 异步
	        dataType:"html",
	        success:function(retData){
	        	if(retData == 1){
	        		alert("审核通过");
	        		window.location.reload();
	        	}else{
	        		alert("审核失败");
	        	}
	        }
		});
	}
</script>
          
</@layout>